﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AxSHDocVw;

namespace Insurance_Quotation_App
{
    public static class Tenet
    {
        private static AxWebBrowser axWebBrowser = null;

        public static void Run(AxWebBrowser axWebBrowser)
        {
            Tenet.axWebBrowser = axWebBrowser;

            axWebBrowser.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(axWebBrowser_DocumentCompleteTenet);
            axWebBrowser.Navigate("https://www.tenetinsurance.com/QuoteEng/Motor/index.aspx?AC=");
        }

        private static void axWebBrowser_DocumentCompleteTenet(object sender, DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            Autofill.SetText(axWebBrowser, "name", "ctl00$PVcontent$dttApplicantDOB", "07/08/1984");
            Autofill.SetSelectList(axWebBrowser, "name", "ctl00$PVcontent$strIdentityType", "Singaporean");
            Autofill.SetRadio(axWebBrowser, "name", "ctl00$PVcontent$bitGender", "bitGender_Male");
            Autofill.SetRadio(axWebBrowser, "name", "ctl00$PVcontent$bitMaritalStatus", "bitMaritalStatus_Single");
            Autofill.SetSelectList(axWebBrowser, "name", "ctl00$PVcontent$strOccupation", "All other indoor occupations");
            Autofill.SetSelectList(axWebBrowser, "name", "ctl00$PVcontent$intDrivingXp", "8");
            Autofill.SetRadio(axWebBrowser, "name", "ctl00$PVcontent$bitValidLicense", "bitValidLicense_Yes");
            Autofill.SetSelectList(axWebBrowser, "name", "ctl00$PVcontent$intNoClaims", "0");
            Autofill.SetSelectList(axWebBrowser, "name", "ctl00$PVcontent$strTotalClaimAmt", "0");
            Autofill.SetSelectList(axWebBrowser, "name", "ctl00$PVcontent$intNCD", "50");
            Autofill.SetSelectList(axWebBrowser, "name", "ctl00$PVcontent$strYrManufacture", "2005");
            Autofill.SetSelectList(axWebBrowser, "name", "ctl00$PVcontent$strYrRegistration", "2005");
            Autofill.SetSelectList(axWebBrowser, "name", "ctl00$PVcontent$strSeatingCapacity", "05   ");//don't know about the spacing.. but it's there =/
            Autofill.SetText(axWebBrowser, "name", "ctl00$PVcontent$dttCOEExpiry", "05/08/2015");
            Autofill.SetRadio(axWebBrowser, "name", "ctl00$PVcontent$bitNotYoungDriver", "bitNotYoungDriver_Agree");

            Autofill.ClickButton(axWebBrowser, "name", "ctl00$PVcontent$Submit", "input");
        }
    }
}
